package com.zyx.config;

import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Yaxi.Zhang
 * @since 2022/10/6 16:47
 */
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
        // swagger2
        registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
        // knife4j
        // registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }

    // @Override
    // public void addInterceptors(InterceptorRegistry registry) {
    //     registry.addInterceptor(new JWTInterceptor())
    //             .excludePathPatterns("user/login")
    //             .excludePathPatterns("user/register")
    //             .excludePathPatterns("/swagger-resources/**")
    //             .excludePathPatterns("/swagger-ui.html/**")
    //             .excludePathPatterns("/webjars/**");
    // }
}
